<template>
<div>
  <van-nav-bar
      title="退款售后"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
  />
  <ul>
    <li v-for="item in list" :key="item.orderId">
      <div>订单号：{{item.orderCode}}</div>
      <div>
        <van-card
                :num="item.orderGoodsNum"
                tag="正品"
                :price="item.orderGoodsPrice"
                :desc="item.goodsDesc"
                :title="item.goodsName"
                :thumb="item.orderImg"
        />
      </div>
      <div>{{item.tai}}</div>
      <div><van-button plain type="primary" color="red" size="small" @click="goRefunds(item.orderId)">查看详情</van-button></div>
    </li>
  </ul>
</div>
</template>

<script>
import { Toast } from 'vant';
export default {
name: "refund",
  data(){
  return{
    list:[],
  }
  },
  mounted() {
  this.refundLoading();
  },
  methods: {
    onClickLeft() {
      Toast('返回');
    },
    goRefunds(row){
      console.log(row);
        this.$router.push({name:'refunds',query: {Id:row}})
    },
    refundLoading(){
      this.$axios.post('/api/marketOrder/myOrderList?userId=1&orderStatus=7').then((res)=>{
        let refundList=res.data.data;
        console.log(res);
        if(res.data.code==200){
          refundList.forEach((item,index)=>{
            this.list.push(item)
            if(item.goods.goodsImg){
              this.list[index].orderImg='http://172.17.4.241:8887/upload/'+item.goods.goodsImg;
            }else {
              this.list[index].orderImg='https://ssyerv1.oss-cn-hangzhou.aliyuncs.com/picture/9c8e4afbe8174349ad8bf3a0d4cac457.jpg!sswm';
            }
            if(item.goods.goodsName){
              this.list[index].goodsName=item.goods.goodsName
            }else {
              this.list[index].goodsName='抹茶香草春居图';
            }
            if(item.goods.goodsDesc){
              this.list[index].goodsDesc=item.goods.goodsDesc
            }else {
              this.list[index].goodsDesc='实惠装';
            }
            if(item.orderIsDone==3){
              item.tai='仅退款,退款成功';
            }if(item.orderIsDone==2){
              item.tai='仅退款,等待商家退款';
            }
            console.log(this.list);
          })
        }
      })
    }
  },
}
</script>

<style scoped>
  ul{
    background-color: #eeeeee;
  }
ul>li{
  list-style-type: none;
  background-color: white;
  margin-bottom: 15px;
}
  ul>li>div:nth-child(1){
    text-align: left;
    padding-top: 5px;
    margin: 0px 0px 5px 15px;
  }
  ul>li>div:nth-child(3){
    text-align: left;
    color: red;
    padding-top: 10px;
    padding-left: 15px;
  }
  ul>li>div:nth-child(4){
    text-align: right;
    padding-right: 15px;
    padding-bottom: 10px;
  }
</style>